package com.weacar.weixin.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler;

import javax.servlet.http.HttpServletRequest;

/**
 * @author Fong
 */
@ControllerAdvice
public class MyExceptionHandler extends ResponseEntityExceptionHandler {
    private static final Logger LOG = LoggerFactory.getLogger(MyExceptionHandler.class);


    @ResponseStatus(value = HttpStatus.OK)
    @ExceptionHandler({Exception.class, RuntimeException.class})
    public ResponseEntity<Object> badRequest(HttpServletRequest req, Exception exception) {
        return new ResponseEntity<Object>(HttpStatus.OK);
    }

}
